const express = require('express')
const userCtrl = require('../controller/user')
const userValidator=require('../validator/user')
const auth=require('../middleware/auth')

const router = express.Router()

// 用户登录
router.post('/user/login', userValidator.login,userCtrl.login)

// 用户注册
router.post('/users',userValidator.register,userCtrl.register) //3，验证通过后执行具体业务需求


// 获取当前登录用户
router.get('/users', auth,userCtrl.getUser)
// 更新当前登录用户
router.put('/user', auth, userCtrl.putUser)


module.exports = router
